def is_valid_speech(text : str, confidence : float = 1) -> bool:
    """
    检查语音识别结果是否有效

    :param text: 识别出的文本
    :param confidence: 识别置信度
    :return: 是否有效
    """

    # 规则1：置信度过低 → 无效
    if confidence < 0.5:
        return False
    
    # 规则2：文本本身无意义
    meaningless = ['嗯', '呃', '啊', '哦', '哼', '咳', '那个', '就是']
    cleaned = ''.join(c for c in text if c.isalnum())
    if cleaned in meaningless and len(cleaned) < 3:
        return False
    
    # 规则3：太短
    if len(cleaned) < 2:
        return False

    return True